Skip to content

[nfc] Avoid pointer conversions #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 1, 2023

Conversation

glessard
Copy link
Contributor

@glessard glessard commented Aug 31, 2023

Preparing for a compiler that's less permissive about pointer conversions.

  1. Use the stdlib's pattern for lazy atomic references, by explicitly declaring the pointer as a computed property.
  2. Use an explicit pointer when a C function isn't detected as such by the compiler.

- avoids reliance on a pointer conversion
@glessard glessard requested review from natecook1000 and Azoy August 31, 2023 21:29
@glessard
Copy link
Contributor Author

@swift-ci please test

@natecook1000
Copy link
Member

LGTM - how did you discover these issues? New compiler, or certain flags?

@glessard
Copy link
Contributor Author

glessard commented Aug 31, 2023

This was using a compiler branch that implements (most of) my restricted pointer conversions pitch.

- this function is imported in a way that causes the compiler to not detect it as a C function
@glessard glessard force-pushed the pointer-conversion-restriction branch from 45fdb08 to 74637cc Compare August 31, 2023 22:11
@glessard
Copy link
Contributor Author

@swift-ci please test linux platform

@natecook1000
Copy link
Member

@swift-ci Please test

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@glessard
Copy link
Contributor Author

glessard commented Sep 1, 2023

This should be cherry-picked to the branch used for development snapshot toolchains.

@glessard glessard merged commit 45fd8ec into swiftlang:main Sep 1, 2023
@glessard glessard deleted the pointer-conversion-restriction branch September 1, 2023 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants